from torch.utils.tensorboard import SummaryWriter
from torchvision import transforms
from PIL import Image

'''
     python的用法 -> tensor数据类型
     通过 transform.ToTensor去看两个问题
     
'''
img_path = r'F:\86135\Documents\DL_torch\data\train\ants_image\0013035.jpg'
img = Image.open(img_path)
writer = SummaryWriter('logs')

# 1、如何使用transform
tensor_trans = transforms.ToTensor()
tensor_img = tensor_trans(img)

writer.add_image('Tensor_img', tensor_img)
writer.close()